﻿
using Comdiv.Model.Mapping;
using FluentNHibernate;
using NHibernate.Cfg;

namespace Comdiv.Dbfs{
    public class DbfsModel : PersistenceModel, IConfigurationBoundedModel
    {
        public DbfsModel(){
            AddMappingsFromAssembly(typeof(DbfsModel).Assembly);
        }

        public bool IsFor(Configuration cfg){
            if (cfg.Properties.ContainsKey("__connectionname"))
            {
                if (cfg.Properties["__connectionname"].ToLower()=="dbfs")
                {
                    return true;
                }
            }
            if (cfg.Properties.ContainsKey("__connection"))
            {
                if (cfg.Properties["__connection"].ToLower().Contains("dbfs"))
                {
                    return true;
                }
            }
            return false;
        }
    }
}